﻿namespace Framework.Text
{
    /// <summary>
    ///   序列化
    /// </summary>
    /// <typeparam name = "T">类型</typeparam>
    /// <typeparam name = "TS">序列化器</typeparam>
    public static class Serializee<T, TS> where TS : ISerializer<T>, new()
    {
        /// <summary>
        ///   序列化
        /// </summary>
        /// <returns></returns>
        public static string Serialize(T obj)
        {
            return new TS().Serialize(obj);
        }

        /// <summary>
        ///   反序列化
        /// </summary>
        /// <returns></returns>
        public static T Deserialize(string input)
        {
            return new TS().Deserialize(input);
        }
    }
}